package util;
/**
* @author Sebastian
* @author Gottschalk
* @author Piesold
*/
public class Car implements Comparable<Car>{

  private String identificationNumber;
  private Colour colour;
  private EngineType engineType;
  private int yearOfConstruction;
  private double originPrice;
  private double price;
  private int mileage;
  private boolean isSelled;
  private String carType;
  private String manufacturer;
  private String model;

  
  /**
   * create a new <code>Car</code>
   * @param identificationNumber the identificationNumber of this <code>Car</code>
   * @param colour the {@link Colour colour} of this <code>Car</code>
   * @param engineType the {@link EngineType engineType} of this <code>Car</code>
   * @param yearOfConstruction the year of construction of this <code>Car</code>
   * @param originPrice the originPrice of this <code>Car</code>
   * @param price the price of this <code>Car</code>
   * @param mileage the mileage of this <code>Car</code>
   * @param isSelled the flag, weather this <code>Car</code> is sell
   */
  public Car( String identificationNumber, Colour theColour,
		EngineType theEngineType, int yearOfConstruction, double originPrice, double price,
		int mileage, boolean isSelled, String carType, String manufacturer, String model ) {
	
	this.identificationNumber = identificationNumber;
	this.colour = theColour;
	this.engineType = theEngineType;
	this.yearOfConstruction = yearOfConstruction;
	this.originPrice = originPrice;
	this.price = price;
	this.mileage = mileage;
	this.isSelled = isSelled;
	this.carType = carType;
	this.manufacturer = manufacturer;
	this.model = model;
  }  
  /**
   * create a new <code>Car</code>
   * @param identificationNumber the identificationNumber of this <code>Car</code> 
   */
  public Car( String identificationNumber ) {
	this.identificationNumber = identificationNumber;
  }  
  /**
   * create a new <code>Car</code>
   */
  public Car( ) { }
  /**
   * @return the identificationNumber
   */
  public String getIdentificationNumber() {
	return this.identificationNumber;
  }
  /**
   * @param identificationNumber the identificationNumber to set
   */
  public void setIdentificationNumber(String identificationNumber) {
  	this.identificationNumber = identificationNumber;
  }
  /**
   * @return the theColour
   */
  public Colour getColour() {
  	return this.colour;
  }
  /**
   * @param theColour the theColour to set
   */
  public void setTheColour(Colour theColour) {
  	this.colour = theColour;
  }
  /**
   * @return the theEngineType
   */
  public EngineType getEngineType() {
  	return this.engineType;
  }
  /**
   * @param theEngineType the theEngineType to set
   */
  public void setEngineType(EngineType theEngineType) {
  	this.engineType = theEngineType;
  }
  /**
   * @return the year
   */
  public int getYearOfConstruction() {
  	return this.yearOfConstruction;
  }
  /**
   * @param year the year to set
   */
  public void setYearOfConstruction(int yearOfConstruction) {
  	this.yearOfConstruction = yearOfConstruction;
  }
  /**
   * @return the originPrice
   */
  public double getOriginPrice() {
  	return this.originPrice;
  }
  /**
   * @param originPrice the originPrice to set
   */
  public void setOriginPrice(double originPrice) {
  	this.originPrice = originPrice;
  }
  /**
   * @return the price
   */
  public double getPrice() {
  	return this.price;
  }
  /**
   * @param price the price to set
   */
  public void setPrice(double price) {
  	this.price = price;
  }
  /**
   * @return the mileage
   */
  public int getMileage() {
  	return this.mileage;
  }
  /**
   * @param mileage the mileage to set
   */
  public void setMileage(int mileage) {
  	this.mileage = mileage;
  }
  /**
   * @return the isSelled
   */
  public boolean isSelled() {
  	return this.isSelled;
  }
  /**
   * @param isSelled the isSelled to set
   */
  public void setSelled(boolean isSelled) {
  	this.isSelled = isSelled;
  }
  /**
 * @return the carType
 */
public String getCarType() {
	return carType;
}
/**
 * @param carType the carType to set
 */
public void setCarType(String carType) {
	this.carType = carType;
}
/**
 * @return the manufacturer
 */
public String getManufacturer() {
	return manufacturer;
}
/**
 * @param manufacturer the manufacturer to set
 */
public void setManufacturer(String manufacturer) {
	this.manufacturer = manufacturer;
}
/**
 * @return the model
 */
public String getModel() {
	return model;
}
/**
 * @param model the model to set
 */
public void setModel(String model) {
	this.model = model;
}
/**
 * @param colour the colour to set
 */
public void setColour(Colour colour) {
	this.colour = colour;
}
/**
   * if identification number differs or is equal
   */
  public boolean equals(Object obj){
	  
	  if(obj.getClass().equals(Car.class)){
		  
		  Car theOtherCar = (Car)obj;
		  
		  if(this.identificationNumber!=null || theOtherCar.identificationNumber!=null){
			  
			  if(this.identificationNumber.equals(theOtherCar.identificationNumber)){
				  
				  return true;
			  }
		  }
	  }
	  return false;
  }
  /**
   * @return uses the mileage
   */
  public int hashcode(){
	  return this.mileage;
  }
  /**
   * @param
   */
  public int compareTo(Car theOtherCar) {
	
	  if(! this.identificationNumber.equals(theOtherCar.identificationNumber) ){
		
		  return this.identificationNumber.compareTo(theOtherCar.identificationNumber);
	  }
	  return 0;
  }
/* (non-Javadoc)
 * @see java.lang.Object#toString()
 */
@Override
public String toString() {
	return "Car [identificationNumber=" + identificationNumber + "]";
}
  
}